package com.woniuxy.user.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;

public enum CommonEnum {

    MAN(1,"男"),
    WOMAN(2,"女"),
    PAY(1,"已支付"),
    NO_PAY(1,"已支付"),
    ;

    CommonEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
   // @EnumValue 注解说明在数据库中保存的是该值。
    @EnumValue
    private final int code;
    private final String desc;

//  @JsonValue 注解代表查询返回给前端的属性对象
    @JsonValue
    public Map result() {
        Map map = new HashMap();
        map.put("code",code);
        map.put("desc",desc);
        return map;
    }
}